/*
 * Copyrignt (c) xuzeshui.com. All Rights Reserved.
 * Author: Zeshui Xu<i@xuzeshui.com>
 * Created Time: 2016-08-26 19:28:57
 * Last Modified: 2016-08-26 19:40:37
 * File Name: controllers/filmvideo.go
 * Description:
 */
package controllers

import (
	"advertoper/errorcode"
	"advertoper/filmvideo"
)

type FilmVideoClientController struct {
	URLSignController
}

func (p *FilmVideoClientController) Prepare() {
	p.URLSignController.Prepare()
	p.ForceHTTPS()
}

// @router /list [get]
func (p *FilmVideoClientController) ListMediaInfo() {
	defer p.Output("ListMediaInfo")
	start, _ := p.GetInt("start", 0)
	length, _ := p.GetInt("length", 20)
	if length == 0 || length > 20 {
		length = 20
	}
	p.Resp["code"] = errorcode.EC_GL_SUCCESS
	p.Resp["msg"] = errorcode.Msg(errorcode.EC_GL_SUCCESS)
	data := filmvideo.ListMediaInfo(start, length)
	p.Resp["data"] = data
	p.Resp["start"] = start
	p.Resp["length"] = len(data)
	p.Resp["hash_more"] = len(data) >= length
}
